# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-cpppo
pkgname=('python2-cpppo' 'python-cpppo')
_pkgname=cpppo
pkgver=5.2.5
pkgrel=1
pkgdesc='A Communication Protocol Python Parser and Originator.'
arch=('any')
url='https://pypi.org/project/cpppo/#files'
license=('GPL3')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('fb5452d0b3875f6a49731132a5da098220816dab598bab1d0bd33405e63b56037449d85be7a85742043df918a8b3917544123e25c88cb762065e826c2dae2c7f')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-cpppo() {
  depends=('python2' 'python2-greenery' 'python2-ipaddress')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build

  for i in "$pkgdir/usr/bin/"*; do
    mv $i "${i}2"
  done
}

package_python-cpppo() {
  depends=('python' 'python-greenery')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build
}

